package com.kaifamiao.set;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class KaifamiaoSet<E> implements Set<E>{
	
	private static final Object PRESENT = new Object();
	
	private HashMap<E,Object> map ;
	
	public KaifamiaoSet() {
		super();
		map = new HashMap<E, Object>();
	}

	@Override
	public int size() {
		return map.size();
	}

	@Override
	public boolean isEmpty() {
		return map.isEmpty();
	}

	@Override
	public boolean contains(Object o) {
		return map.containsKey( o );
	}

	@Override
	public Iterator<E> iterator() {
		return null;
	}

	@Override
	public Object[] toArray() {
		return null;
	}

	@Override
	public <T> T[] toArray(T[] a) {
		return null;
	}

	@Override
	public boolean add(E e) {
		return map.put( e , PRESENT ) == null ; 
	}

	@Override
	public boolean remove(Object o) {
		return map.remove( o ) == PRESENT ;
	}

	@Override
	public boolean containsAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean addAll(Collection<? extends E> c) {
		return false;
	}

	@Override
	public boolean retainAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean removeAll(Collection<?> c) {
		return false;
	}

	@Override
	public void clear() {
		map.clear();
	}

}
